package teach.day04;

import java.util.Stack;

//栈
public class P05StackDemo {
    public static void main(String[] args) {
        //First in Last Out
        Stack<Integer> stack = new Stack<Integer>();
        for (int i = 0; i < 10; i++) {
            stack.push(i); //入栈
        }
        while (!stack.isEmpty()) {  //判断栈是否为空
            System.out.println(stack.peek());   //输出栈顶元素
            stack.pop();    //出栈
        }
    }
}
